package sis.studentinfo;/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-07-24 20:05
 * @notify
 * @version 1.0
 */

public class Performance {
    //学生成绩
    private int[] tests ={};

    //设置总共几次成绩
    public void setNumberOfTests(int numberOfTests) {
        tests = new int[numberOfTests];
    }

    //设置每次考试成绩
    public void set(int testNumber, int scoer) {
        tests[testNumber] = scoer;
    }

    //获取指定考试的成绩
    public int get(int testNumber) {
        return tests[testNumber];
    }

    //平均每次考试成绩
    public double average() {
        if(tests.length==0){
            return 0;
        }
        double total = 0.0;
        for (int score : tests) {
            total += score;
        }
        return total / tests.length;
    }



    //批量设置学生成绩
    public void setScores(int ... tests) {
        this.tests = tests;
    }
}
